<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" isELIgnored="false" %>
<html>
<head>
    <link rel="stylesheet" href="statics/css/xgxt_login.css"/>
    <title>百知教育注册页面</title>
    <script type="text/javascript" src="statics/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
        $(function(){
            $("#username").change(function(){
                $.get("user","username="+this.value+"&method=check",function(data){
                    if(data==1){
                        $("#usernameMsg").html("用户名已经存在").css("color","red");
                        $("#registerBtn").attr("disabled",true);
                    }else{
                        $("#usernameMsg").html("用户名可用").css("color","green");
                        $("#registerBtn").removeAttr("disabled");
                    }
                })
            });
        })
    </script>
</head>
<body>

<div id="header">
    <div class="header_title">
        <span class="title_con">TJCU系统注册</span>
    </div>
</div>

<div id="content">
    <center>
        <div class="con">
            <div class="con_title">
                <span class="con_title_sp">欢迎注册TJCU系统</span>
            </div>
            <div class="con_panel">
                <form action="${pageContext.request.contextPath}/user/register" method="get">
                    <div class="con_input">
                        <span>用户名：</span><input type="text" name="user.username" placeholder="请输入你的姓名"/>
                        <div >
                            <p class="text-danger"><span class="help-block " id="usernameMsg"></span></p>
                        </div>
                    </div>
                    <div class="con_input">
                        <span>密&nbsp;&nbsp;&nbsp;&nbsp;码：</span><input type="text" name="user.password"
                                                                       placeholder="密码"/>
                    </div>
                    <div class="con_input">
                        <span>邮&nbsp;&nbsp;&nbsp;&nbsp;箱：</span><input type="text" name="user.email"
                                                                       placeholder="请输入你的邮箱"/>
                    </div>
                    <div class="con_input">
                        <span>角&nbsp;&nbsp;&nbsp;&nbsp;色：</span>
                        <select name="user.role">
                            <option  value="1">管理员</option>
                            <option  value="0">用户</option>
                        </select>
                    </div>
                    <input type="submit" value="注册" class="submit-btn"/>
                    <div>${requestScope.registerMsg}</div>
                </form>
                <div style="float: right;">
                    <a href="login.jsp">返回登陆页面</a>
                </div>
            </div>
        </div>
    </center>
</div>

</body>
</html>
